package api

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

// PageResponse 分页响应结构
type PageResponse struct {
	List  interface{} `json:"list"`  // 数据列表
	Total int64       `json:"total"` // 总记录数
}

// Paginate 分页响应
func Paginate(c *gin.Context, list interface{}, total int64) {
	c.JSON(http.StatusOK, Response{
		Code:    http.StatusOK,
		Message: "success",
		Data: PageResponse{
			List:  list,
			Total: total,
		},
	})
}
